package cn.xingzhen.jfield.componet;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import java.awt.*;

/**
 * @author wenqiang
 * @date 2023/5/6
 * @comment ..
 */
public class XzTextArea extends JTextArea {

    public XzTextArea(int width, int height) {
        super();
        setPreferredSize(new Dimension(width, height));
        initDefault();
    }

    public XzTextArea() {
        super();
        initDefault();
    }

    private void initDefault() {
        Border border;
        if (XzUIConfigure.SHOW_BORDER) {
            border = BorderFactory.createLineBorder(XzUIConfigure.BORDER_COLOR);
        } else {
            border = BorderFactory.createCompoundBorder();
        }
        EmptyBorder emptyBorder = new EmptyBorder(5, 5, 5, 5);
        setBorder(new CompoundBorder(emptyBorder, border));
        //setLineWrap(true); // 设置自动换行
    }

}
